package acm.pta5;

import java.util.Scanner;

public class T1_6 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        int count=1;
        int m=1;
        while (m<n){
            m=m*10+1;
            count++;
        }
        StringBuilder sb=new StringBuilder();
        while (m%n!=0){
            sb.append(m/n);
            m=(m%n)*10+1;
            count++;
        }
        sb.append(m/n);
        System.out.println(sb+" "+count);
    }
}
